package report

import (
	"../common"
	"../web"
)

type QueryCtrlRunObj struct {
	common.BaseHandler
}

func (self *QueryCtrlRunObj) ParameterCheck() bool {
	return true
}

func (self *QueryCtrlRunObj) SqlQueryExecute() {
	wo_main := *common.FetchAllRowsPtr(
		`SELECT TOP 30 A.WONO,A.WOTYPE,A.REV,A.ITEM,B.DESCRIP,A.QTY,ISNULL(A.ROUTING,''),ISNULL(A.REMARK, '')
           FROM SFC_WO A(NOLOCK)
           JOIN SFC_ITEMS B(NOLOCK)
             ON A.ITEM=B.ITEM
          WHERE A.WOTYPE='CONTROL-RUN'
          ORDER BY A.MODIFYDATE DESC`,
		self.Usr.Conn, new(common.WoMain))
	self.TmplData["wo_main"] = wo_main
}

func ControlRunQueryHandler(ctx *web.Context) {
	self := new(QueryCtrlRunObj)
	self.Ctx = ctx
	self.Html = "controlrunquery.html"
	self.Rightlist = []string{"controlrun"}
	self.DoQueryUrl(self)
}
